package shiyanbaogao;

public class Test3 {
    public  static class Employee {
        // 1. 定义私有的成员变量
        private String name;
        private int age;
        private double salary;

        // 2. 编写有参和无参的职工类构造方法
        public Employee() {
        }

        public Employee(String name, int age, double salary) {
            this.name = name;
            this.age = age;
            this.salary = salary;
        }

        // 3. 编写访问私有成员变量的get/set方法
        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }

        public double getSalary() {
            return salary;
        }

        public void setSalary(double salary) {
            this.salary = salary;
        }

        // 4. 编写显示职工信息的方法
        public void displayInfo() {
            System.out.println("职工姓名：" + name);
            System.out.println("职工年龄：" + age);
            System.out.println("职工薪资：" + salary);
        }
    }

}
